#!/sbin/openrc-run

name=lemmy-ui
description="Lemmy UI"

export NODE_ENV=production
export LEMMY_UI_HOST
export LEMMY_UI_LEMMY_INTERNAL_HOST
export LEMMY_UI_LEMMY_EXTERNAL_HOST
export LEMMY_UI_HTTPS

command="/usr/bin/node"
command_args="dist/js/server.js"
command_background=true
command_user="lemmy-ui:lemmy-ui"
pidfile="/run/${RC_SVCNAME}.pid"
directory="/usr/share/webapps/lemmy-ui"
error_log="/var/log/lemmy-ui.log"

depend() {
	need localmount net
	after firewall lemmy
}

start_pre() {
	checkpath -f -m 0640 -o "$command_user" "$error_log"
}
